<?php

namespace app\home\controller;
use cmf\controller\UserBaseController;
use think\Db;

//会员登录验证
class MemberloginController extends UserBaseController{
    public function index(){
        return $this->fetch();
    }
    public function dologin(){
        if($_POST){
            $phone=$_POST['mobile'];
            $type=$_POST['type'];
            if($type=='cord')
            {
                $where['card_id']=$phone;
            }else{
                $where['mobile']=$phone;
            }
            $pwd= Db::name('member')->where($where)->find();
            $result = cmf_compare_password($_POST['password'],$pwd['mempass']);
            if($result == null){

                $this->success("登录失败");
            }else{
				$phones=array();
				$phones['sate']=1;
				$phones['mop']=$pwd['mobile'];
				session('phoneone',$phones);
                $this->success("登录成功");
            }
        }
    }
    public function memlist(){
        $mobile = $_SESSION["think"]['mobile'];
        $where['a.mobile']=$mobile;
        $list = Db::name('member')->where($where)->alias('a')->join('__FINANCE__ b','a.id=b.userid','left')->join('__INTEGRAL__ c','a.id=c.userid','left')->join('__STORE__ d','a.store_id=d.id','left')->field('a.*,b.money,c.num,d.store_name')->select();
        $this->assign('list',$list);
        return $this->fetch();
    }
}

